package net.peihuan.service.impl;

import net.peihuan.dao.CategoryMapper;
import net.peihuan.dao.FriendlinkMapper;
import net.peihuan.entity.Friendlink;
import net.peihuan.service.LinkService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Service
@Transactional
public class LinkServiceImpl implements LinkService{

    @Resource
    private FriendlinkMapper friendlinkMapper;

    @Override
    public List<Friendlink> findAllFriendLinks() {
        return friendlinkMapper.findAllFriendLinks();
    }

    @Override
    public int addFriendLink(Friendlink link) {
        return friendlinkMapper.insert(link);
    }

    @Override
    public int removeFriendLink(int id) {
        return friendlinkMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int count() {
        return friendlinkMapper.count();
    }

    @Override
    public int update(Friendlink friendlink) {
        return friendlinkMapper.updateByPrimaryKeySelective(friendlink);
    }

    @Override
    public Friendlink findLink(int id) {
        return friendlinkMapper.selectByPrimaryKey(id);
    }
}
